<template>
    <div>
        <div class="udlite-container partners">
            <van-cell-group>
                <van-tabs>

                    <van-tab title="Gitee登录">
                    <van-field v-model="username" label="用户名" placeholder="Gitee用户名"></van-field>        
                    </van-tab>

                </van-tabs>

            </van-cell-group>
             <van-button type="primary" @click="login">登录</van-button>
        </div>
    </div>
</template>

<script>
import axios from 'axios'

export default {
    data() {
        return {
            username:''
        }
    },
    methods: {
        login(){
            axios({
                url:'http://127.0.0.1:8000/gitee_login/',
                method:'post',
                data:{
                    username:this.username
                }
            }).then(res=>{
                console.log(res.data)
                if(res.data.code == 1000){
                    this.$router.push('myindex')
                    localStorage.setItem('username',this.username)
                }
            })
        }
        },
    created() {

    }
}
</script>

<style scoped>

</style>
